import java.util.ArrayListimport com.google.gson.Gsonimport java.net.URLEncoderimport java.net.URL
import groovyx.gaelyk.logging.GroovyLoggerresponse.setContentType("application/jsonrequest")log.info "start"def tag = request.getParameter("tag")log.info "tag :" +tag
String[] returnAR = new String[3];Gson gson = new Gson();returnAR[0] ="VALUE"returnAR[1] =tagreturnAR[2] = process(tag)log.info "returnAR[2] :" +returnAR[2]log.info "gson.toJson(returnAR) :" +gson.toJson(returnAR)println gson.toJson(returnAR)private Collection<String> process(String tag){	Collection<String> value = new ArrayList<String>();	def adresse = URLEncoder.encode(tag)	def path = "http://www.google.fr/ig/api?weather=${adresse}&hl=fr"	def url = new URL(path);	def content = url.getText() 	def xml_api_reply = new XmlSlurper().parseText(content)	def weather = xml_api_reply.weather	def current_conditions = weather.current_conditions.icon.@data.text()	value.add(current_conditions)	weather.forecast_conditions.list().each(){		def icon = it.icon.@data.text()		value.add(icon)	}	return value}